using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UI_ScrollSelect : MonoBehaviour
{
    [SerializeField] private UI_ScrollSelectSlot[] _scrollSelectSlots;
    private UI uI;
    private void Awake()
    {
        uI = GetComponentInParent<UI>();
    }
    public void SetupScrollSelect(SlotScorllDataSO[] scorllDataSOs)
    {
        for (int i = 0; i < _scrollSelectSlots.Length; i++)
        {
            if (i < scorllDataSOs.Length)
                _scrollSelectSlots[i].SetupScrollSelectSlot(scorllDataSOs[i]);
        }
    }
    
    public void ClickSelectButton()
    {
        for (int i = 0; i < _scrollSelectSlots.Length; i++)
        {
            UI_ScrollSelectSlot scrollSelectSlot = _scrollSelectSlots[i];
            if (scrollSelectSlot.IsSelect())
                EventCenter.TriggerEvent(EventName.UI_AddScrollSlot, scrollSelectSlot.CurrentScorllDataSO);
        }
        gameObject.SetActive(false);

        uI.EnableUIInput(false);
    }
}
